Fix/bootstrap starting for def#1270
Conversation
DavertMik
left a comment
There was a problem hiding this comment.
Ok, I have 2 suggestions:
- make
initsynchronous without callback - add
bootstrapexecution torun-multiplecommand
lib/codecept.js
Outdated
| * @param {() => any} [done] | ||
| */ | ||
| bootstrap(done) { | ||
| runHooks(done) { |
There was a problem hiding this comment.
looks like runHooks are synchronous now, so done is not needed and callback functions.
Also I'm going to deprecate custom hooks in config so this code should be 100% synchronous
DavertMik
left a comment
There was a problem hiding this comment.
Ok, I have 2 suggestions:
- make
initsynchronous without callback - add
bootstrapexecution torun-multiplecommand - remove bootstrap from gherkin* commands (as they don't execute tests)
lib/command/gherkin/steps.js
Outdated
| } | ||
| if (err) throw new Error(`Error while running init :${err}`); | ||
|
|
||
| codecept.runBootstrap((err) => { |
There was a problem hiding this comment.
bootstrap should not be run for listing steps definition (as it's not executed for def)
lib/command/gherkin/snippets.js
Outdated
| files.push(fsPath.resolve(file)); | ||
| }); | ||
| output.print(`Loaded ${files.length} files`); | ||
| codecept.runBootstrap((err) => { |
There was a problem hiding this comment.
gherkin:snippets should not execute bootstrap (as it's omitted for def/list commands as well)
|
Done 1st and 3rd. About 2nd: |
|
Awesome, thanks! |
Removed config's bootstrap and teardown calls for
codeceptjs defandcodeceptjs listBefore, bootstrap has started (and set up connection to browserstack, for example) before
defcommand, which is unnecessary.Also, teardown has started after these commands.
TypeError: done is not a functionerror occurred.